package com.mvc.controller;

import com.mvc.pojo.Dept;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/param")
public class ParamController {
    @RequestMapping("/get")
    public String get(String name, Integer age) {
        return "name:" + name + " age:" + age;
    }
    @PostMapping("/post")
    public String post(Dept dept) {
        return "name:" + dept.getDname() + " loc:" + dept.getLoc();
    }

    @PutMapping("/put")
    public String update(Dept dept) {
        return "name:" + dept.getDname() + " loc:" + dept.getLoc();
    }
    @DeleteMapping("/delete")
    public String delete(Integer id) {
        return "id:" + id;
    }

    @PostMapping("/upload")
    public String upload(@RequestParam("file") MultipartFile file) {
        return "file:" + file.getOriginalFilename();
    }
}
